﻿using System.Reflection;
using System.IO;
namespace Model {
    
    
    public partial class StudentDataSet {
        partial class StudentDataTable
        {
        }
    
        private static StudentDataSet _instance;
        private static object _lockObject = new object();

        internal static StudentDataSet Instance
        {
            get
            {
                if (_instance == null)
                {
                    lock (_lockObject)
                    {
                        if (_instance == null)
                        {
                            _instance = CreateLoaded();
                        }
                    }
                }
                return _instance;
            }
        }

        private static StudentDataSet CreateLoaded()
        {
            StudentDataSet ds = new StudentDataSet();

            Assembly currentAssembly = Assembly.GetExecutingAssembly();
            using (Stream dataStream = currentAssembly.GetManifestResourceStream("Model.StudentData.xml"))
            {
                ds.ReadXml(dataStream);
            }
            return ds;

        }
    }
}
